<?php
/*由bean脚本生成 powerBy--joe*/
namespace app\common\validate;

use app\common\bean\UserBean;

class UserValidate extends BaseValidate
{

	static $all = 'all';
	static $add = 'add';
	static $edit = 'edit';
	static $pkId = 'id';

	public function __construct(array $rules = [], array $message = [], array $field = [])
	{
		parent::__construct($rules, $message, $field);
		$this->rule = [
			 UserBean::$id => 'require', //
			 UserBean::$nickname => 'require|max:255', //微信昵称
			 UserBean::$gender => 'require', //0保密 1男 2女
			 UserBean::$publicOpenId => 'require|max:255', //微信公众号openid
			 UserBean::$appletOpenId => 'require|max:255', //小程序openid
			 UserBean::$unionId => 'require|max:255', //unionid
			 UserBean::$avatarUrl => 'require|max:255', //微信头像地址
			 UserBean::$mobilePhone => 'require|max:255', //微信获取手机号码
			 UserBean::$status => 'require', //状态（1、正常，2、禁用）
			 UserBean::$city => 'require|max:255', //城市
			 UserBean::$province => 'require|max:255', //省份
			 UserBean::$country => 'require|max:255', //国家
			 UserBean::$parentId => 'require', //上级用户id
			 UserBean::$createdAt => 'require', //创建时间
			 UserBean::$updatedAt => 'require', //更新时间
			 UserBean::$storeId => 'require', //最后访问店id
			 UserBean::$blance => 'require', //余额
		];
		$this->message = [
			UserBean::$id.POINST."require " => 'id必须', //
			UserBean::$nickname.POINST."require " => 'nickname必须', //微信昵称
			UserBean::$gender.POINST."require " => 'gender必须', //0保密 1男 2女
			UserBean::$publicOpenId.POINST."require " => 'public_open_id必须', //微信公众号openid
			UserBean::$appletOpenId.POINST."require " => 'applet_open_id必须', //小程序openid
			UserBean::$unionId.POINST."require " => 'union_id必须', //unionid
			UserBean::$avatarUrl.POINST."require " => 'avatar_url必须', //微信头像地址
			UserBean::$mobilePhone.POINST."require " => 'mobile_phone必须', //微信获取手机号码
			UserBean::$status.POINST."require " => 'status必须', //状态（1、正常，2、禁用）
			UserBean::$city.POINST."require " => 'city必须', //城市
			UserBean::$province.POINST."require " => 'province必须', //省份
			UserBean::$country.POINST."require " => 'country必须', //国家
			UserBean::$parentId.POINST."require " => 'parent_id必须', //上级用户id
			UserBean::$createdAt.POINST."require " => 'created_at必须', //创建时间
			UserBean::$updatedAt.POINST."require " => 'updated_at必须', //更新时间
			UserBean::$storeId.POINST."require " => 'store_id必须', //最后访问店id
			UserBean::$blance.POINST."require " => 'blance必须', //余额
		];
		$this->scene = [
			self::$all => [UserBean::$id,UserBean::$nickname,UserBean::$gender,UserBean::$avatarUrl,UserBean::$mobilePhone,UserBean::$status,UserBean::$city,UserBean::$province,UserBean::$country,UserBean::$parentId,UserBean::$createdAt,UserBean::$updatedAt,],
            self::$add => [UserBean::$nickname,UserBean::$avatarUrl,UserBean::$appletOpenId,UserBean::$createdAt],
            self::$edit => [UserBean::$id],
            self::$pkId => [UserBean::$id]
		];
	}


}
